import {createRouter, createWebHistory} from "vue-router";
import Layout from "@/layout/LayoutMain.vue";

const routes = [
    {
        name: 'layout',
        path: "/",
        redirect: "/index",
        component: Layout,
        children: [
            {
                name: "index",
                path: "/index",
                component: () => import("@/views/index/index.vue"),
                meta: {
                    title: "首页",
                }
            },
            {
                name: "search",
                path: "/search",
                component: () => import("@/views/search/search.vue"),
                meta: {
                    title: "搜索",
                }
            },
            {
                name:'productCenter',
                path:"/productCenter",
                component:()=>import("@/views/product/productCenter.vue"),
                meta: {
                    title: "产品中心"
                }
            },
            {
                name:'productDetail',
                path:"/product/:productId",
                component:()=>import("@/views/product/productDetail.vue"),
                meta: {
                    title: "产品详情"
                }
            },
            {
                name:'about',
                path:"/about",
                component:()=>import("@/views/about/companyInfo.vue"),
                meta: {
                    title: "关于我们"
                }
            }
        ]
    }
]
const router = createRouter({
    history: createWebHistory(),
    routes: routes
})

export default router
